package com.accesshollywood.grfxOrdering.orderTreeSpecial;

import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent;
import java.awt.dnd.DropTargetListener;
import java.awt.event.ActionListener;
import java.util.ArrayList;

import javax.swing.BoxLayout;
import javax.swing.JPanel;
import javax.swing.border.EtchedBorder;
import javax.swing.border.TitledBorder;

import com.accesshollywood.grfxOrdering.orderTreeSpecial.models.AbstractButtonPlusModel;
import com.accesshollywood.grfxOrdering.orderTreeSpecial.models.ItemTableModel;
import com.accesshollywood.grfxOrdering.panels.ButtonListPanel;
import com.accesshollywood.indexables.items.GrfxItem;

public class ItemPanel extends JPanel{
	public ArrayList<AbstractButtonPlusModel>	allButtons	= new ArrayList<AbstractButtonPlusModel>();
	public ButtonListPanel						btnFilename;
	public JPanel filePanel;
	public ButtonListPanel textPanel;
	public ButtonListPanel stillsPanel;
	public ButtonListPanel footagePanel;

	public ItemPanel(ItemTableModel currItems) {
		setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
		addItemTree(currItems);
	}

	public void addItemTree(ItemTableModel currItems) {
		/*
		removeAll();
		for (int i = 0; i < currItems.grfxOrder.items.size(); i++) {
			GrfxItem currItem = currItems.grfxOrder.items.get(i);

			JPanel itemPanel = new JPanel();
			itemPanel.setLayout(new BoxLayout(itemPanel, BoxLayout.Y_AXIS));
			itemPanel.setBorder(new TitledBorder(new EtchedBorder(), ""));
			add(itemPanel);

			JPanel itemSubPanel = new JPanel();
			itemSubPanel.setLayout(new BoxLayout(itemSubPanel, BoxLayout.Y_AXIS));
			itemSubPanel.setAlignmentX(LEFT_ALIGNMENT);
			itemPanel.add(itemSubPanel);

			filePanel = new JPanel();
			filePanel.setLayout(new BoxLayout(filePanel, BoxLayout.X_AXIS));
			filePanel.setAlignmentX(LEFT_ALIGNMENT);
			itemPanel.add(filePanel);

			btnFilename = new ButtonListPanel(false);
			btnFilename.createH("Filename:", currItem.filename, allButtons);
			filePanel.add(btnFilename);

			if (currItem.textList.size() > 0) {
				textPanel = new ButtonListPanel(false);
				textPanel.setBorder(new TitledBorder(new EtchedBorder(), "TEXT"));
				itemSubPanel.add(textPanel);
				textPanel.setAlignmentX(LEFT_ALIGNMENT);
				textPanel.createV("Copy", currItem.textList, allButtons);
			}

			if (currItem.stillList.size() > 0) {
				stillsPanel = new ButtonListPanel(true);
				stillsPanel.setBorder(new TitledBorder(new EtchedBorder(), "STILLS"));
				itemSubPanel.add(stillsPanel);
				stillsPanel.setAlignmentX(LEFT_ALIGNMENT);
				stillsPanel.createV("Open Folder", currItem.stillList, allButtons);
				stillsPanel.setBGOnApproval(true);
			}

			if (currItem.footageList.size() > 0) {
				footagePanel = new ButtonListPanel(true);
				footagePanel.setBorder(new TitledBorder(new EtchedBorder(), "FOOTAGE"));
				itemSubPanel.add(footagePanel);
				footagePanel.setAlignmentX(LEFT_ALIGNMENT);
				footagePanel.createV("Open Folder", currItem.footageList, allButtons);
				footagePanel.setBGOnApproval(true);
			}
		}
		*/
	}

	public void addButtonListener(AbstractButtonPlusModel button, ActionListener actionListener) {
		button.addActionListener(actionListener);
	}
}
